import request from '@/utils/request'
import { download } from '@/utils/request'

// 新增AB题
export function addAb(data) {
  return request({
    url: '/businessCore/faAbQuestions',
    method: 'post',
    data
  })
}

// 修改AB题
export function updateAb(data) {
  return request({
    url: '/businessCore/faAbQuestions',
    method: 'put',
    data
  })
}

// 删除AB题
export function delAb(id) {
  return request({
    url: '/businessCore/faAbQuestions/' + id,
    method: 'delete'
  })
}

// 获取AB题
export function getAb(id) {
  return request({
    url: '/businessCore/faAbQuestions/' + id,
    method: 'get'
  })
}

// 导出AB题
export function exportAb(params, fileName) {
  const url = '/businessCore/faAbQuestions/export'
  download(
    url,
    params,
    fileName + `_${new Date().getTime()}.xlsx`
  )
}